home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 March / PCWMAR09.iso / Software / Freeware / NSIS 2.41 / nsis-2.41-setup.exe / Examples / FileFuncTest.nsi < prev    next >
Encoding:
Text File  |  2008-10-10  |  15.1 KB  |  617 lines

  1. ;_____________________________________________________________________________
  2. ;
  3. ;                          File Functions Test
  4. ;_____________________________________________________________________________
  5. ;
  6. ; 2006 Shengalts Aleksander aka Instructor (Shengalts@mail.ru)
  7.  
  8. Name "File Functions Test"
  9. OutFile "FileFuncTest.exe"
  10. Caption "$(^Name)"
  11. ShowInstDetails show
  12. XPStyle on
  13. RequestExecutionLevel user
  14.  
  15. Var FUNCTION
  16. Var OUT1
  17. Var OUT2
  18. Var OUT3
  19. Var OUT4
  20. Var OUT5
  21. Var OUT6
  22. Var OUT7
  23.  
  24. !include "FileFunc.nsh"
  25. !include "LogicLib.nsh"
  26.  
  27. !insertmacro Locate
  28. !insertmacro GetSize
  29. !insertmacro DriveSpace
  30. !insertmacro GetDrives
  31. !insertmacro GetTime
  32. !insertmacro GetFileAttributes
  33. !insertmacro GetFileVersion
  34. !insertmacro GetExeName
  35. !insertmacro GetExePath
  36. !insertmacro GetParameters
  37. !insertmacro GetOptions
  38. !insertmacro GetOptionsS
  39. !insertmacro GetRoot
  40. !insertmacro GetParent
  41. !insertmacro GetFileName
  42. !insertmacro GetBaseName
  43. !insertmacro GetFileExt
  44. !insertmacro BannerTrimPath
  45. !insertmacro DirState
  46. !insertmacro RefreshShellIcons
  47.  
  48. !insertmacro un.Locate
  49. !insertmacro un.GetSize
  50. !insertmacro un.GetDrives
  51. !insertmacro un.DriveSpace
  52. !insertmacro un.GetTime
  53. !insertmacro un.GetFileAttributes
  54. !insertmacro un.GetFileVersion
  55. !insertmacro un.GetExeName
  56. !insertmacro un.GetExePath
  57. !insertmacro un.GetParameters
  58. !insertmacro un.GetOptions
  59. !insertmacro un.GetOptionsS
  60. !insertmacro un.GetRoot
  61. !insertmacro un.GetParent
  62. !insertmacro un.GetFileName
  63. !insertmacro un.GetBaseName
  64. !insertmacro un.GetFileExt
  65. !insertmacro un.BannerTrimPath
  66. !insertmacro un.DirState
  67. !insertmacro un.RefreshShellIcons
  68.  
  69.  
  70.  
  71. ;############### INSTALL ###############
  72.  
  73. !define StackVerificationStart `!insertmacro StackVerificationStart`
  74. !macro StackVerificationStart _FUNCTION
  75.     StrCpy $FUNCTION ${_FUNCTION}
  76.     Call StackVerificationStart
  77. !macroend
  78.  
  79. !define StackVerificationEnd `!insertmacro StackVerificationEnd`
  80. !macro StackVerificationEnd
  81.     Call StackVerificationEnd
  82. !macroend
  83.  
  84. Function StackVerificationStart
  85.     StrCpy $0 !0
  86.     StrCpy $1 !1
  87.     StrCpy $2 !2
  88.     StrCpy $3 !3
  89.     StrCpy $4 !4
  90.     StrCpy $5 !5
  91.     StrCpy $6 !6
  92.     StrCpy $7 !7
  93.     StrCpy $8 !8
  94.     StrCpy $9 !9
  95.     StrCpy $R0 !R0
  96.     StrCpy $R1 !R1
  97.     StrCpy $R2 !R2
  98.     StrCpy $R3 !R3
  99.     StrCpy $R4 !R4
  100.     StrCpy $R5 !R5
  101.     StrCpy $R6 !R6
  102.     StrCpy $R7 !R7
  103.     StrCpy $R8 !R8
  104.     StrCpy $R9 !R9
  105. FunctionEnd
  106.  
  107. Function StackVerificationEnd
  108.     IfErrors +3
  109.     DetailPrint 'PASSED $FUNCTION no errors'
  110.     goto +2
  111.     DetailPrint 'FAILED   $FUNCTION error'
  112.  
  113.     StrCmp $0 '!0' 0 error
  114.     StrCmp $1 '!1' 0 error
  115.     StrCmp $2 '!2' 0 error
  116.     StrCmp $3 '!3' 0 error
  117.     StrCmp $4 '!4' 0 error
  118.     StrCmp $5 '!5' 0 error
  119.     StrCmp $6 '!6' 0 error
  120.     StrCmp $7 '!7' 0 error
  121.     StrCmp $8 '!8' 0 error
  122.     StrCmp $9 '!9' 0 error
  123.     StrCmp $R0 '!R0' 0 error
  124.     StrCmp $R1 '!R1' 0 error
  125.     StrCmp $R2 '!R2' 0 error
  126.     StrCmp $R3 '!R3' 0 error
  127.     StrCmp $R4 '!R4' 0 error
  128.     StrCmp $R5 '!R5' 0 error
  129.     StrCmp $R6 '!R6' 0 error
  130.     StrCmp $R7 '!R7' 0 error
  131.     StrCmp $R8 '!R8' 0 error
  132.     StrCmp $R9 '!R9' 0 error
  133.     DetailPrint 'PASSED $FUNCTION stack'
  134.     goto end
  135.  
  136.     error:
  137.     DetailPrint 'FAILED   $FUNCTION stack'
  138. ;    MessageBox MB_OKCANCEL '$$0={$0}$\n$$1={$1}$\n$$2={$2}$\n$$3={$3}$\n$$4={$4}$\n$$5={$5}$\n$$6={$6}$\n$$7={$7}$\n$$8={$8}$\n$$9={$9}$\n$$R0={$R0}$\n$$R1={$R1}$\n$$R2={$R2}$\n$$R3={$R3}$\n$$R4={$R4}$\n$$R5={$R5}$\n$$R6={$R6}$\n$$R7={$R7}$\n$$R8={$R8}$\n$$R9={$R9}' IDOK +2
  139. ;    quit
  140.  
  141.     end:
  142. FunctionEnd
  143.  
  144.  
  145.  
  146. Section Locate
  147.     ${StackVerificationStart} Locate
  148.  
  149.     ${Locate} '$DOCUMENTS' '/L=FD /M=*.* /S=0B /G=0' 'LocateCallback'
  150.  
  151.     ${StackVerificationEnd}
  152. SectionEnd
  153.  
  154. Function LocateCallback
  155. ;    MessageBox MB_YESNO '$$0={$0}$\n$$1={$1}$\n$$2={$2}$\n$$3={$3}$\n$$4={$4}$\n$$5={$5}$\n$$6={$6}$\n$$7={$7}$\n$$8={$8}$\n$$9={$9}$\n$$R0={$R0}$\n$$R1={$R1}$\n$$R2={$R2}$\n$$R3={$R3}$\n$$R4={$R4}$\n$$R5={$R5}$\n$$R6={$R6}$\n$$R7={$R7}$\n$$R8={$R8}$\n$$R9={$R9}$\n$\nContinue?' IDYES +2
  156. ;    StrCpy $0 StopLocate
  157.  
  158.     Push $0
  159. FunctionEnd
  160.  
  161.  
  162. Section GetSize
  163.     ${StackVerificationStart} GetSize
  164.  
  165.     ${GetSize} '$WINDIR' '/M=Explorer.exe /S=0K /G=0' $OUT1 $OUT2 $OUT3
  166.  
  167.     ${StackVerificationEnd}
  168. SectionEnd
  169.  
  170.  
  171. Section DriveSpace
  172.     ${StackVerificationStart} DriveSpace
  173.  
  174.     ${DriveSpace} 'C:\' '/D=F /S=M' $OUT1
  175.  
  176.     ${StackVerificationEnd}
  177. SectionEnd
  178.  
  179.  
  180. Section GetDrives
  181.     ${StackVerificationStart} GetDrives
  182.  
  183.     ${GetDrives} 'FDD+CDROM' 'GetDrivesCallback'
  184.  
  185.     ${StackVerificationEnd}
  186. SectionEnd
  187.  
  188. Function GetDrivesCallback
  189. ;    MessageBox MB_YESNO '$$0={$0}$\n$$1={$1}$\n$$2={$2}$\n$$3={$3}$\n$$4={$4}$\n$$5={$5}$\n$$6={$6}$\n$$7={$7}$\n$$8={$8}$\n$$9={$9}$\n$$R0={$R0}$\n$$R1={$R1}$\n$$R2={$R2}$\n$$R3={$R3}$\n$$R4={$R4}$\n$$R5={$R5}$\n$$R6={$R6}$\n$$R7={$R7}$\n$$R8={$R8}$\n$$R9={$R9}$\n$\nContinue?' IDYES +2
  190. ;    StrCpy $0 StopGetDrives
  191.  
  192.     Push $0
  193. FunctionEnd
  194.  
  195.  
  196. Section GetTime
  197.     ${StackVerificationStart} GetTime
  198.  
  199.     ${GetTime} '' 'L' $OUT1 $OUT2 $OUT3 $OUT4 $OUT5 $OUT6 $OUT7
  200.  
  201.     ${StackVerificationEnd}
  202. SectionEnd
  203.  
  204.  
  205. Section GetFileAttributes
  206.     ${StackVerificationStart} GetFileAttributes
  207.  
  208.     ${GetFileAttributes} '$WINDIR\explorer.exe' 'ALL' $OUT1
  209.  
  210.     ${StackVerificationEnd}
  211. SectionEnd
  212.  
  213.  
  214. Section GetFileVersion
  215.     ${StackVerificationStart} GetFileVersion
  216.  
  217.     ${GetFileVersion} '$WINDIR\explorer.exe' $OUT1
  218.  
  219.     ${StackVerificationEnd}
  220. SectionEnd
  221.  
  222.  
  223. Section GetExeName
  224.     ${StackVerificationStart} GetExeName
  225.  
  226.     ${GetExeName} $OUT1
  227.  
  228.     ${StackVerificationEnd}
  229. SectionEnd
  230.  
  231.  
  232. Section GetExePath
  233.     ${StackVerificationStart} GetExePath
  234.  
  235.     ${GetExePath} $OUT1
  236.  
  237.     ${StackVerificationEnd}
  238. SectionEnd
  239.  
  240.  
  241. Section GetParameters
  242.     ${StackVerificationStart} GetParameters
  243.  
  244.     # basic stuff
  245.  
  246.     StrCpy $CMDLINE '"$PROGRAMFILES\Something\Hello.exe"'
  247.     ${GetParameters} $OUT1
  248.     StrCpy $CMDLINE '"$PROGRAMFILES\Something\Hello.exe" test'
  249.     ${GetParameters} $OUT2
  250.     StrCpy $CMDLINE '"$PROGRAMFILES\Something\Hello.exe" "test"'
  251.     ${GetParameters} $OUT3
  252.     StrCpy $CMDLINE 'C:\Hello.exe'
  253.     ${GetParameters} $OUT4
  254.     StrCpy $CMDLINE 'C:\Hello.exe test'
  255.     ${GetParameters} $OUT5
  256.     StrCpy $CMDLINE 'C:\Hello.exe "test"'
  257.     ${GetParameters} $OUT6
  258.     StrCpy $CMDLINE 'C:\Hello.exe       test test  '
  259.     ${GetParameters} $OUT7
  260.  
  261.     ${If} $OUT1 != ""
  262.     ${OrIf} $OUT2 != "test"
  263.     ${OrIf} $OUT3 != '"test"'
  264.     ${OrIf} $OUT4 != ""
  265.     ${OrIf} $OUT5 != "test"
  266.     ${OrIf} $OUT6 != '"test"'
  267.     ${OrIf} $OUT7 != 'test test'
  268.         SetErrors
  269.     ${EndIf}
  270.  
  271.     # some corner cases
  272.  
  273.     StrCpy $CMDLINE ''
  274.     ${GetParameters} $OUT1
  275.     StrCpy $CMDLINE '"'
  276.     ${GetParameters} $OUT2
  277.     StrCpy $CMDLINE '""'
  278.     ${GetParameters} $OUT3
  279.     StrCpy $CMDLINE '"" test'
  280.     ${GetParameters} $OUT4
  281.     StrCpy $CMDLINE ' test'
  282.     ${GetParameters} $OUT5
  283.     StrCpy $CMDLINE '  test' # left over bug(?) from old GetParameters
  284.                              # it starts looking for ' ' from the third char
  285.     ${GetParameters} $OUT6
  286.     StrCpy $CMDLINE ' '
  287.     ${GetParameters} $OUT7
  288.  
  289.     ${If} $OUT1 != ""
  290.     ${OrIf} $OUT2 != ""
  291.     ${OrIf} $OUT3 != ""
  292.     ${OrIf} $OUT4 != ""
  293.     ${OrIf} $OUT5 != ""
  294.     ${OrIf} $OUT6 != ""
  295.     ${OrIf} $OUT7 != ""
  296.         SetErrors
  297.     ${EndIf}
  298.  
  299.     ${StackVerificationEnd}
  300. SectionEnd
  301.  
  302.  
  303. Section GetOptions
  304.     ${StackVerificationStart} GetOptions
  305.  
  306.     ${GetOptions} '/INSTDIR=C:\Program Files\Common Files /SILENT=yes' '/INSTDIR=' $OUT1
  307.     StrCmp $OUT1 'C:\Program Files\Common Files' 0 error
  308.  
  309.     ${GetOptions} '-TMP=temp.tmp -INSTDIR="C:/Program Files/Common Files" -SILENT=yes' '-INSTDIR=' $OUT1
  310.     StrCmp $OUT1 'C:/Program Files/Common Files' 0 error
  311.  
  312.     ${GetOptions} "/INSTDIR='C:/Program Files/Common Files' /SILENT=yes" '/INSTDIR=' $OUT1
  313.     StrCmp $OUT1 'C:/Program Files/Common Files' 0 error
  314.  
  315.     StrCpy $OUT1 '/INSTDIR=`C:/Program Files/Common Files` /SILENT=yes'
  316.     ${GetOptions} '$OUT1' '/INSTDIR=' $OUT1
  317.     StrCmp $OUT1 'C:/Program Files/Common Files' 0 error
  318.  
  319.     ${GetOptions} '/SILENT=yes /INSTDIR=C:\Program Files\Common Files' '/INSTDIR=' $OUT1
  320.     StrCmp $OUT1 'C:\Program Files\Common Files' 0 error
  321.  
  322.     ${GetOptions} "/INSTDIR=common directory: 'C:\Program Files\Common Files' /SILENT=yes" '/INSTDIR=' $OUT1
  323.     StrCmp $OUT1 "common directory: 'C:\Program Files\Common Files'" 0 error
  324.  
  325.     ${GetOptions} '/INSTDIR=WxxxW /SILENT=yes' '/INSTDIR=' $OUT1
  326.     StrCmp $OUT1 'WxxxW' 0 error
  327.  
  328.     ${GetOptions} "/Prm='/D=True' /D=1" '/D=' $OUT1
  329.     StrCmp $OUT1 "1" 0 error
  330.  
  331.     ${GetOptions} "/D=1 /Prm='/D=True'" '/Prm=' $OUT1
  332.     StrCmp $OUT1 "/D=True" 0 error
  333.  
  334.     ${GetOptions} `/D=1 /Prm='/D="True" /S="/Temp"'` '/Prm=' $OUT1
  335.     StrCmp $OUT1 '/D="True" /S="/Temp"' 0 error
  336.  
  337.     ${GetOptions} `/INSTDIR='"C:/Program Files/Common Files"' /SILENT=yes` '/INSTDIR=' $OUT1
  338.     StrCmp $OUT1 '"C:/Program Files/Common Files"' 0 error
  339.  
  340.     ${GetOptions} `/INSTDIR='"C:/Program Files/Common Files"' /SILENT=yes` '/INSTDIR*=' $OUT1
  341.     IfErrors 0 error
  342.     StrCmp $OUT1 '' 0 error
  343.  
  344.     ${GetOptions} `/INSTDIR="C:/Program Files/Common Files" /SILENT=yes` '' $OUT1
  345.     IfErrors 0 error
  346.     StrCmp $OUT1 '' 0 error
  347.  
  348.     ${GetOptionsS} '/INSTDIR=C:\Program Files\Common Files /SILENT' '/SILENT' $OUT1
  349.     IfErrors error
  350.     StrCmp $OUT1 '' 0 error
  351.  
  352.     goto +2
  353.     error:
  354.     SetErrors
  355.  
  356.     ${StackVerificationEnd}
  357. SectionEnd
  358.  
  359.  
  360. Section GetOptionsS
  361.     ${StackVerificationStart} GetOptionsS
  362.  
  363.     ${GetOptionsS} '/INSTDIR=C:\Program Files\Common Files /SILENT=yes' '/INSTDIR=' $OUT1
  364.     IfErrors error
  365.     StrCmp $OUT1 'C:\Program Files\Common Files' 0 error
  366.  
  367.     ${GetOptionsS} '/INSTDIR=C:\Program Files\Common Files /SILENT=yes' '/Instdir=' $OUT1
  368.     IfErrors 0 error
  369.     StrCmp $OUT1 '' 0 error
  370.  
  371.     ${GetOptionsS} '/INSTDIR=C:\Program Files\Common Files /SILENT' '/SILENT' $OUT1
  372.     IfErrors error
  373.     StrCmp $OUT1 '' 0 error
  374.  
  375.     goto +2
  376.     error:
  377.     SetErrors
  378.  
  379.     ${StackVerificationEnd}
  380. SectionEnd
  381.  
  382.  
  383. Section GetRoot
  384.     ${StackVerificationStart} GetRoot
  385.  
  386.     ${GetRoot} 'C:\Program Files\NSIS' $OUT1
  387.     StrCmp $OUT1 'C:' 0 error
  388.  
  389.     ${GetRoot} '\\SuperPimp\NSIS\Source\exehead\Ui.c' $OUT1
  390.     StrCmp $OUT1 '\\SuperPimp\NSIS' 0 error
  391.  
  392.     ${GetRoot} '\\Program Files\NSIS' $OUT1
  393.     StrCmp $OUT1 '\\Program Files\NSIS' 0 error
  394.  
  395.     ${GetRoot} '\\Program Files\NSIS\' $OUT1
  396.     StrCmp $OUT1 '\\Program Files\NSIS' 0 error
  397.  
  398.     ${GetRoot} '\\Program Files\NSIS\Source\exehead\Ui.c' $OUT1
  399.     StrCmp $OUT1 '\\Program Files\NSIS' 0 error
  400.  
  401.     ${GetRoot} '\Program Files\NSIS' $OUT1
  402.     StrCmp $OUT1 '' 0 error
  403.  
  404.     goto +2
  405.     error:
  406.     SetErrors
  407.  
  408.     ${StackVerificationEnd}
  409. SectionEnd
  410.  
  411.  
  412. Section GetParent
  413.     ${StackVerificationStart} GetParent
  414.  
  415.     ${GetParent} 'C:\Program Files\Winamp\uninstwa.exe' $OUT1
  416.     StrCmp $OUT1 'C:\Program Files\Winamp' 0 error
  417.  
  418.     ${GetParent} 'C:\Program Files\Winamp\plugins' $OUT1
  419.     StrCmp $OUT1 'C:\Program Files\Winamp' 0 error
  420.  
  421.     ${GetParent} 'C:\Program Files\Winamp\plugins\' $OUT1
  422.     StrCmp $OUT1 'C:\Program Files\Winamp' 0 error
  423.  
  424.     ${GetParent} 'C:\' $OUT1
  425.     StrCmp $OUT1 '' 0 error
  426.  
  427.     goto +2
  428.     error:
  429.     SetErrors
  430.  
  431.     ${StackVerificationEnd}
  432. SectionEnd
  433.  
  434.  
  435. Section GetFileName
  436.     ${StackVerificationStart} GetFileName
  437.  
  438.     ${GetFileName} 'C:\Program Files\Winamp\uninstwa.exe' $OUT1
  439.     StrCmp $OUT1 'uninstwa.exe' 0 error
  440.  
  441.     ${GetFileName} 'uninstwa.exe' $OUT1
  442.     StrCmp $OUT1 'uninstwa.exe' 0 error
  443.  
  444.     ${GetFileName} 'C:\Program Files\Winamp\plugins' $OUT1
  445.     StrCmp $OUT1 'plugins' 0 error
  446.  
  447.     ${GetFileName} 'C:\Program Files\Winamp\plugins\' $OUT1
  448.     StrCmp $OUT1 'plugins' 0 error
  449.  
  450.     goto +2
  451.     error:
  452.     SetErrors
  453.  
  454.     ${StackVerificationEnd}
  455. SectionEnd
  456.  
  457.  
  458. Section GetBaseName
  459.     ${StackVerificationStart} GetBaseName
  460.  
  461.     ${GetBaseName} 'C:\Program Files\Winamp\uninstwa.exe' $OUT1
  462.     StrCmp $OUT1 'uninstwa' 0 error
  463.  
  464.     ${GetBaseName} 'uninstwa.exe' $OUT1
  465.     StrCmp $OUT1 'uninstwa' 0 error
  466.  
  467.     ${GetBaseName} 'C:\Program Files\Winamp\plugins' $OUT1
  468.     StrCmp $OUT1 'plugins' 0 error
  469.  
  470.     ${GetBaseName} 'C:\Program Files\Winamp\plugins\' $OUT1
  471.     StrCmp $OUT1 '' 0 error
  472.  
  473.     goto +2
  474.     error:
  475.     SetErrors
  476.  
  477.     ${StackVerificationEnd}
  478. SectionEnd
  479.  
  480.  
  481. Section GetFileExt
  482.     ${StackVerificationStart} GetFileExt
  483.  
  484.     ${GetFileExt} 'C:\Program Files\Winamp\uninstwa.exe' $OUT1
  485.     StrCmp $OUT1 'exe' 0 error
  486.  
  487.     ${GetFileExt} 'uninstwa.exe' $OUT1
  488.     StrCmp $OUT1 'exe' 0 error
  489.  
  490.     ${GetFileExt} 'C:\Program Files\Winamp\plugins' $OUT1
  491.     StrCmp $OUT1 '' 0 error
  492.  
  493.     ${GetFileExt} 'C:\Program Files\Winamp\plugins\' $OUT1
  494.     StrCmp $OUT1 '' 0 error
  495.  
  496.     goto +2
  497.     error:
  498.     SetErrors
  499.  
  500.     ${StackVerificationEnd}
  501. SectionEnd
  502.  
  503.  
  504. Section BannerTrimPath
  505.     ${StackVerificationStart} BannerTrimPath
  506.  
  507.     ${BannerTrimPath} 'C:\Server\Documents\Terminal\license.htm' '35A' $OUT1
  508.     StrCmp $OUT1 'C:\Server\...\Terminal\license.htm' 0 error
  509.  
  510.     ${BannerTrimPath} 'C:\12\3456\789' '3A' $OUT1
  511.     StrCmp $OUT1 '' 0 error
  512.  
  513.     ${BannerTrimPath} 'C:\12\3456\789' '4A' $OUT1
  514.     StrCmp $OUT1 'C...' 0 error
  515.  
  516.     ${BannerTrimPath} 'C:\12\3456\789' '11A' $OUT1
  517.     StrCmp $OUT1 'C:\12\...' 0 error
  518.  
  519.     ${BannerTrimPath} 'C:\12\3456\789' '13A' $OUT1
  520.     StrCmp $OUT1 'C:\12\...\789' 0 error
  521.  
  522.     ${BannerTrimPath} 'C:\12\3456\789' '14A' $OUT1
  523.     StrCmp $OUT1 'C:\12\3456\789' 0 error
  524.  
  525.     ${BannerTrimPath} 'C:\12\3456\789' '14A' $OUT1
  526.     StrCmp $OUT1 'C:\12\3456\789' 0 error
  527.  
  528.     ${BannerTrimPath} 'C:\12\3456\789' '11B' $OUT1
  529.     StrCmp $OUT1 'C:\12\...' 0 error
  530.  
  531.     ${BannerTrimPath} 'C:\12\3456\789' '5B' $OUT1
  532.     StrCmp $OUT1 'C:...' 0 error
  533.  
  534.     ${BannerTrimPath} 'C:\12\3456\789' '5B' $OUT1
  535.     StrCmp $OUT1 'C:...' 0 error
  536.  
  537.     ${BannerTrimPath} 'C:\12\3456\789' '11C' $OUT1
  538.     StrCmp $OUT1 'C:\12\34...' 0 error
  539.  
  540.     ${BannerTrimPath} 'C:\12\3456\789' '9D' $OUT1
  541.     StrCmp $OUT1 'C:\12\...' 0 error
  542.  
  543.     ${BannerTrimPath} 'C:\12\3456\789' '10D' $OUT1
  544.     StrCmp $OUT1 'C:\...\789' 0 error
  545.  
  546.     ${BannerTrimPath} 'C:\12\3456\789' '11D' $OUT1
  547.     StrCmp $OUT1 'C:\1...\789' 0 error
  548.  
  549.     ${BannerTrimPath} '123456789' '5D' $OUT1
  550.     StrCmp $OUT1 '12...' 0 error
  551.  
  552.     goto +2
  553.     error:
  554.     SetErrors
  555.  
  556.     ${StackVerificationEnd}
  557. SectionEnd
  558.  
  559.  
  560. Section DirState
  561.     ${StackVerificationStart} DirState
  562.  
  563.     ${DirState} '$TEMP' $OUT1
  564.  
  565.     ${StackVerificationEnd}
  566. SectionEnd
  567.  
  568.  
  569. Section RefreshShellIcons
  570.     ${StackVerificationStart} RefreshShellIcons
  571.  
  572.     ${RefreshShellIcons}
  573.  
  574.     ${StackVerificationEnd}
  575. SectionEnd
  576.  
  577.  
  578. Section WriteUninstaller
  579.     goto +2
  580.     WriteUninstaller '$EXEDIR\un.FileFuncTest.exe'
  581. SectionEnd
  582.  
  583.  
  584.  
  585. ;############### UNINSTALL ###############
  586.  
  587. Section un.Uninstall
  588.     ${un.Locate} '$DOCUMENTS' '/L=FD /M=*.* /S=0B /G=0' 'un.LocateCallback'
  589.     ${un.GetSize} '$WINDIR' '/M=Explorer.exe /S=0K /G=0' $OUT1 $OUT2 $OUT3
  590.     ${un.DriveSpace} 'C:\' '/D=F /S=M' $OUT1
  591.     ${un.GetDrives} 'FDD+CDROM' 'un.GetDrivesCallback'
  592.     ${un.GetTime} '' 'L' $OUT1 $OUT2 $OUT3 $OUT4 $OUT5 $OUT6 $OUT7
  593.     ${un.GetFileAttributes} '$WINDIR\explorer.exe' 'ALL' $OUT1
  594.     ${un.GetFileVersion} '$WINDIR\explorer.exe' $OUT1
  595.     ${un.GetExeName} $OUT1
  596.     ${un.GetExePath} $OUT1
  597.     ${un.GetParameters} $OUT1
  598.     ${un.GetOptions} '/INSTDIR=C:\Program Files\Common Files /SILENT=yes' '/INSTDIR=' $OUT1
  599.     ${un.GetOptionsS} '/INSTDIR=C:\Program Files\Common Files /SILENT=yes' '/INSTDIR=' $OUT1
  600.     ${un.GetRoot} 'C:\Program Files\NSIS' $OUT1
  601.     ${un.GetParent} 'C:\Program Files\Winamp\uninstwa.exe' $OUT1
  602.     ${un.GetFileName} 'C:\Program Files\Winamp\uninstwa.exe' $OUT1
  603.     ${un.GetBaseName} 'C:\Program Files\Winamp\uninstwa.exe' $OUT1
  604.     ${un.GetFileExt} 'C:\Program Files\Winamp\uninstwa.exe' $OUT1
  605.     ${un.BannerTrimPath} 'C:\Server\Documents\Terminal\license.htm' '35A' $OUT1
  606.     ${un.DirState} '$TEMP' $OUT1
  607.     ${un.RefreshShellIcons}
  608. SectionEnd
  609.  
  610. Function un.LocateCallback
  611.     Push $0
  612. FunctionEnd
  613.  
  614. Function un.GetDrivesCallback
  615.     Push $0
  616. FunctionEnd
  617.